Masterarbeit v0.6.2

Docs

Endpoint: /analyze/<id>

Returns the found pairs of color and background color and calculated contrast values as well as proposals.

Request

URL

Method: GET /api/analyze/<id>

Request Parameters

  • id: ID of the website (required)

Request Body

no request body

Response

Response Elements

  • id: ID of the requested website
  • pairs: list of pairs
  • pair.text: text content of pair
  • pair.selector: unique generated selector for DOM element of pair
  • pair.colorServer: resolved font color of pair
  • pair.backgroundColorServer: resolved background color of pair
  • pair.fontSizeServer: resolved font size of in px
  • pair.fontWeightServer: resolved font weight
  • pair.wcag: calculated WCAG contrast of pair
  • pair.apca: calculated APCA contrast of pair
  • pair.colorHighestContrast: calculated color with highest contrast
  • pair.backgroundColorHighestContrast: calculated background color with highest contrast
  • pair.colorWcagAAAContrast: calculated color that most closely meets the WCAG AAA contrast standard
  • pair.backgroundColorWcagAAAContrast: calculated background color that most closely meets the WCAG AAA contrast standard
  • pair.colorApcaSmallbodytextContrast: calculated color that most closely meets the APCA small body text contrast standard
  • pair.backgroundColorApcaSmallbodytextContrast: calculated background color that most closely meets the APCA small body text contrast standard
  • pair.fontSizeHighestValue: calculated font size meeting highest requirements of APCA contrast standard in px
  • pair.fontWeightHighestValue: calculated font weight meeting highest requirements of APCA contrast standard

Examples

Request

GET /api/analyze/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Content-type: application/json

Response

{
  "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "pairs": [
    {
      "text": "This is a header",
      "id": "body:nth-of-type(1) header:nth-of-type(1) h1:nth-of-type(1)",
      "colorServer": "rgb(255, 255, 255)",
      "backgroundColorServer": "rgb(0, 0, 0)"
    },
    {
      "text": "This is a paragraph.",
      // ...
    },
    // ...
  ]
}